package cn.quicklydoit.config;


/**
 * 性别
 */
public enum Sex {
    MALE(0,"男"),
    FEMALE(1,"女"),
    UNKNOWN(-1,"未知");
    private Integer code;
    private String name;

    private Sex(Integer code,String name){
        this.code=code;
        this.name=name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Sex fromCode(Integer code){
        for(Sex sex:Sex.values()){
            if(sex.getCode().equals(code)){
                return  sex;
            }
        }
        return null;
    }

}
